import Vue from 'vue';
import VueRouter from 'vue-router';
import Routers from './router';
import Store from './store.js';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue';
import {getRequest} from './libs/api';
import {postRequest} from './libs/api';
import {deleteRequest} from './libs/api';
import {putRequest} from './libs/api';
import {postRequestJson} from "./libs/api";
import {putRequestJson} from "./libs/api";
import {uploadFileRequest} from "./libs/api";
import {unix2Date} from "./libs/until";
import {assignUtil} from "./libs/until";
import {initField} from "./libs/until";
import 'font-awesome/css/font-awesome.min.css';
import VueCropper from 'vue-cropper';
import VideoPlayer from 'vue-video-player';
require('video.js/dist/video-js.css');
require('vue-video-player/src/custom-theme.css');
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'

Vue.use(VueRouter);
Vue.use(ElementUI);
Vue.use(VueCropper);
Vue.use(VideoPlayer);
Vue.use(VueQuillEditor);

Vue.prototype.getRequest = getRequest;
Vue.prototype.postRequest = postRequest;
Vue.prototype.deleteRequest = deleteRequest;
Vue.prototype.putRequest = putRequest;
Vue.prototype.postRequestJson= postRequestJson;
Vue.prototype.putRequestJson= putRequestJson;
Vue.prototype.uploadFileRequest= uploadFileRequest;
Vue.prototype.unix2Date =unix2Date;
Vue.prototype.assignUtil=assignUtil;
Vue.prototype.initField=initField;

// 路由配置
const RouterConfig = {
  // 使用 HTML5 的 History 路由模式
  // mode: 'history',
  routes: Routers
};
const router = new VueRouter(RouterConfig);

router.beforeEach((to, from, next) => {
  window.document.title = to.meta.title;
  next();
});

router.afterEach(() => {
  window.scrollTo(0, 0);
});

new Vue({
  el: '#app',
  router: router,
  store: Store,
  render: h => {
    return h(App)
  }
});